package com.heima.article.feign;

import com.heima.apis.article.IArticleClient;
import com.heima.article.service.ApArticleService;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class ArticleClient implements IArticleClient {

    @Autowired
    private ApArticleService apArticleService;
    @Override
    public ResponseResult saveArticle(ArticleDto dto) {
        log.info("收到参数:{}",dto);
        try {
            return apArticleService.saveArticle(dto);
            //Thread.sleep(3000);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR);
    }
}
